from control.models import *
from utils.encryptionAndDecryptionUtil import *


# 初始化默认的用户信息进入系统
def init_user_content():

    super_user_data = {}
    super_user_data["user_account"] = "basic_superadmin"
    super_user_data["user_name"] = "默认超级管理员"
    super_user_data["password"] = encryptor_psd("!SuperAdmin1234")
    super_user_data["user_type"] = "super_admin"
    super_user_data["sex"] = "保密"

    super_admin_entity = User.objects.create(**super_user_data)

    # 初始化超级管理员
    super_user_data = {}
    super_user_data["user_account"] = "superadmin"
    super_user_data["user_name"] = "默认超级管理员"
    super_user_data["password"] = encryptor_psd("!SuperAdmin1234")
    super_user_data["user_type"] = "super_admin"
    super_user_data["sex"] = "保密"

    super_admin_entity = User.objects.create(**super_user_data)

    # 初始化其他角色
    User.objects.create(
        **{
            "user_account": "platformadmin",
            "user_name": "默认平台管理员",
            "password": encryptor_psd("!platform12"),
            "user_type": "platform_admin",
        }
    )

    User.objects.create(
        **{
            "user_account": "dataadmin",
            "user_name": "默认数据管理员",
            "password": encryptor_psd("!dataadmin12"),
            "user_type": "data_admin",
        }
    )

    User.objects.create(
        **{
            "user_account": "datasetreviewer",
            "user_name": "默认数据集审核员",
            "password": encryptor_psd("!datasetreviewer12"),
            "user_type": "dataset_reviewer",
        }
    )

    User.objects.create(
        **{
            "user_account": "model_param_admin",
            "user_name": "默认模型参数管理员",
            "password": encryptor_psd("!modelparam12"),
            "user_type": "model_param_admin",
        }
    )

    User.objects.create(
        **{
            "user_account": "generaluser",
            "user_name": "默认一般用户",
            "password": encryptor_psd("!generaluser12"),
            "user_type": "general_user",
        }
    )
